package create_thread;

/**
 * Created with IDEA
 * author:ju bai
 * Date:2021/4/25
 * Time:19:58
 * 创建线程方法 2-1 -- 实现Runnable接口
 **/
public class Thread3 {
    static class MyRunnable implements Runnable {
        @Override
        public void run() {
            System.out.println("线程名称" + Thread.currentThread().getName());
        }
    }

    public static void main(String[] args) {
        //1.新建Runnable类
        MyRunnable runnable = new MyRunnable();
        //2.新建Thread
        Thread thread = new Thread(runnable);
        //3.启动线程
        thread.start();
    }
}
